﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'SelectSemiProductos_InsumosBySemiProductoID')
	BEGIN
		DROP  Procedure  SelectSemiProductos_InsumosBySemiProductoID
	END

GO

CREATE Procedure SelectSemiProductos_InsumosBySemiProductoID
(
	@semiProductoID smallint
)
AS
BEGIN
	SET NOCOUNT ON

	SELECT
	SP_I.[semiProductoID],
	SP_I.[insumoID],
	SP_I.[cantidad],
	I.[nombre] AS 'insumo',
	I.[stock] AS 'stock'
	FROM [SemiProductos_Insumos] SP_I
	INNER JOIN dbo.Insumos I ON SP_I.[insumoID] = I.[insumoID]
	WHERE [semiProductoID] = @semiProductoID

	SET NOCOUNT OFF
END

GO


GRANT EXEC ON SelectSemiProductos_InsumosBySemiProductoID TO PUBLIC

GO

